<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>FormLayout 表单布局</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />

    
    <script src="__PUBLIC__/scripts/boot.js" type="text/javascript"></script>
    
    
    <style type="text/css">
        
       
    </style>

</head>
<body>
    <h1>注册用户</h1>      
  
<div id="form1">  
    <h4>必填</h4>
<table class="form-table" border="0" cellpadding="1" cellspacing="2">
    <tr>
        <td class="form-label" style="width:60px;">用户名：</td>
        <td style="width:100px">
            <input name="username" class="mini-textbox" />
        </td>
    </tr>
    <tr>
        <td class="form-label" style="width:60px;">姓名：</td>
        <td style="width:100px">
            <input name="nickname" class="mini-textbox" />
        </td>
    </tr>
     <tr>
        <td class="form-label">职务说明：</td>
        <td >
        	<input name="position" class="mini-textbox" />
        </td>
    </tr>
    <tr>
        <td class="form-label">密码：</td>
        <td >
            <input name="password" class="mini-password" />
        </td>
    </tr>
	<tr>
	<td>
         <input value="提交" type="button" onclick="submitForm()" />		
 	 
	</td>
	</tr>
</table>
</div>

    <div class="description">
        <h3>用户名为登录名，姓名请填写真实名字</h3>
        <p>            
        </p>
    </div> 
    <script type="text/javascript">
        mini.parse();
		//loadForm();
         function submitForm() {
			//提交表单数据
            var form = new mini.Form("#form1");            
            var data = form.getData();      //获取表单多个控件的数据
            //var json = mini.encode(data);   //序列化成JSON
            $.ajax({
                url: "__APP__/User/add",
                type: "post",
                data: { Data: data },
                success: function (text) {
                    alert("提交成功");
                }
            });

        }
		
		function loadForm() {
            //加载表单数据
            var form = new mini.Form("#form1");            
            $.ajax({
                url: "__APP__/User/loaduserinfo?uid=1",
                type: "post",
                success: function (text) {
					var data = mini.decode(text);
					
                       //反序列化成对象
                    form.setData(data);             //设置多个控件数据
                }
            });
        }
		function CloseWindow(action) {

        if (window.CloseOwnerWindow) window.CloseOwnerWindow(action);

        else window.close();

    	} 

    </script>

    
</body>
</html>